//
var showPage_index = function () {
    // var token = window.localStorage['token'];

    var role = localStorage['role'];
    var menuUrl = "/page/" + role + "/menu";
    var bodyUrl = "/page/" + role + "/home";
    $('#body').load(bodyUrl);
    $('#top').load('/page/top');
    $('#menu').load(menuUrl);
    bodySetting();
    initialize_after();
    if (role === "student") {
        addStudentData(localStorage['id']);
    }

};
var addStudentData = function (id) {
    $.ajax({
        url: "student/findOne",
        type: "post",
        data: {
            "token": localStorage['token'],
            "id": localStorage['id']
        },
        success: function (data) {
            console.log(data);
            localStorage['dormId'] = data.data.dormId;
            localStorage['dorm'] = data.data.dorm;
            localStorage['clas'] = data.data.clas;
            localStorage['clasId'] = data.data.clasId;
        }
    })
};

//
$(window).resize(function () {
    bodySetting();
    // if($(window).width() <= 550){
    //     menu_hid();
    // }else{
    //     menu_show();
    // }
});

var bodySetting = function () {

    var window_width = $(window).innerWidth();
    var body_left = $("#body").position().left;
    var body_width = window_width - body_left - 25;
    $("#body").width(body_width);
};



